<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <meta name="Page-topic" content="ST-Open - Software" />
 <meta name="Description" content="ST-Open - Software" />
 <meta name="Keywords" content="ST-Open Software, Open Source, ST-Open, Software, library, libraries, free software, assembler, C" />
    <meta name="date" content="2009-05-08T00:00:00+00:00" />
 <meta name="robots" content="index,follow" />
 <meta name="revisit-after" content="14 days" />
 <meta name="generator" content="Bernhard Schornak, handwritten" />
 <style type="text/css"><!--@import "../../st.css";--></style>
 <link rel="SHORTCUT ICON" href="../../../../pics/favicon.ico" />
 <title>Memory Management - the ST-Loader</title>
</head>
<body id="top">
<div class="pagehd">
<div id="menu">
<ul>
 <li><a href="../../../indexe.htm">Software</a></li>
 <li><a href="index.htm">Tutorials</a></li>
 <li><a href="../index.htm">Documentation</a></li>
 <li><a href="../alp.htm">alphabetical</a></li>
 <li><a href="../fct.htm">by Function</a></li>
</ul>
</div>
<div class="update">[2009-05-08]</div><div class="headpc"><img src="../../pics/ste.png" alt="SourceDoc Logo" width="75" height="75" border="0" /></div>
</div>
<div class="crlf1"></div>
&#160;&#160;&#160;<a href="index.htm"><img src="../../../../pics/nav_up.png" alt="up" width="20" height="20" border="0" title="up" /></a>
&#160;&#160;&#160;<a href="0300.htm"><img src="../../../../pics/nav_bk.png" alt="previous" width="20" height="20" border="0" title="previous" /></a>
&#160;&#160;&#160;<a href="0401.htm"><img src="../../../../pics/nav_fw.png" alt="next" width="20" height="20" border="0" title="next" /></a>
<div class="text100">
<h1>The Loader</h1>
Initially, the job of the former MemoryManager (MM) was loading and saving fields for the
 database engine. Throughout the time, these functions were expanded to perform required
 tasks and the Loader was born. It opens files, allocates memory blocks and copies file
 contents to allocated blocks. The handling of "normal" files isn't as sophisticated as
 the management of fields, but the required functions are on top of my todo list and will
 be added as soon as I find the time to code them.
<div class="crlf1"></div>
<h2>Dynamic Memory Management</h2>
The parameter block of each MemHandle includes a timestamp which is updated, whenever the
 corresponding field is accessed. If a memory block wasn't touched for the time specified
 in the variable CHK_REMOVE, the Loader stores the field if the content changed and frees
 the allocated memory automatically. The dynamic removing of fields can be overridden if
 you set the flag <b>LDR_STATIC</b> in ld.LdCtl before calling LDreq(), or set this flag
 in the field's header when you create the field. If <b>LDR_STATIC</b> is set, the Loader
 sets the timestamp to 0xFFFFFFFF and the Checker leaves the memory block alone forever.
 You should set this flag for all files, fields and memory blocks if you're not sure how
 long the field is required in your functions.
<div class="crlf1"></div>
The dynamic memory management is controlled via the variables CHK_DELAY and CHK_REMOVE.
 CHK_DELAY defines the time interval between two Checker runs. CHK_REMOVE defines the idle
 time of loaded blocks. If the timestamp expired, the block is removed. Both variables are
 defined in OS/2's time format [HHMMSShh] (hours, minutes, seconds, hundredth of seconds).
 Please do not use hundredth of seconds, the timer only "knows" 18 timer ticks per second.
 Reasonable values are 1 - 3 minutes for CHK_DELAY and 2 - 5 minutes for CHK_REMOVE.
<div class="crlf1"></div>
If you want to use dynamic memory management, CHK_DELAY und CHK_REMOVE must be defined in
 one of your header files. If you use the V700 program skeleton and dynamic management is
 not required: Just remove the WM_TIMER procedure and all lines including CHK_DELAY or
 CHK_REMOVE.
<div class="crlf1"></div>
<h2>Application</h2>
The following pages offer detailed descriptions with code examples how to use the Loader
 properly. Because the tutorial is quite lengthy, it is split into several pages. The next
 page describes how to start and terminate the ST-Loader.
</div>
<div class="crlf2"></div>
&#160;&#160;&#160;<a href="index.htm"><img src="../../../../pics/nav_up.png" alt="up" width="20" height="20" border="0" title="up" /></a>
&#160;&#160;&#160;<a href="0300.htm"><img src="../../../../pics/nav_bk.png" alt="previous" width="20" height="20" border="0" title="previous" /></a>
&#160;&#160;&#160;<a href="0401.htm"><img src="../../../../pics/nav_fw.png" alt="next" width="20" height="20" border="0" title="next" /></a>
<div class="crlf1"></div>
</body>
</html>
